package com.okaixz.client.controller;


import com.okaixz.client.model.domain.KbCustomerAssistant;
import com.okaixz.client.service.IKbCustomerAssistantService;
import com.okaixz.common.client.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author cdz
 * @since 2025-06-05
 */
@RestController
@RequestMapping("/kb/customerAssistant")
public class KbCustomerAssistantController {
    @Autowired
    private IKbCustomerAssistantService kbCustomerAssistantService;
    @GetMapping("/list/{userId}")
    public Result<List<KbCustomerAssistant>> getListbyUserId(@PathVariable(name = "userId") String userId){
        List<KbCustomerAssistant> list=kbCustomerAssistantService.getListbyUserId(userId);
        return Result.success(list);
    }
    @GetMapping("/{id}")
    public Result<KbCustomerAssistant> getListbyUserId(@PathVariable(name = "id") Long id){
        KbCustomerAssistant kbCustomerAssistant=kbCustomerAssistantService.getById(id);
        return Result.success(kbCustomerAssistant);
    }
    @PostMapping("/add")
    public Result<KbCustomerAssistant> addCustomerAssistant(@RequestBody KbCustomerAssistant kbCustomerAssistant){
        KbCustomerAssistant result=kbCustomerAssistantService.add(kbCustomerAssistant);
        return Result.success(result);
    }

}
